main(h,m)
{
	for(gets(&h);~scanf("%d:%d",&h,&m);printf("%.1f %.1f\n",h*30+m*.5,m*6.));
}
